package com.mxm.mirai.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mxm.mirai.dao.Botconfig;
import com.mxm.mirai.dao.Pay;
import com.mxm.mirai.mapper.PayMapper;
import com.mxm.mirai.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 漫小猫
 * @since 2020-09-24
 */
@Service
public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements PayService {

    @Autowired
    PayMapper payMapper;
    private Pay pay = null;

    @Override
    public boolean AddPay(Pay pay) {
        try {
            if(payMapper.insert(pay)!=-1){
                return true;
            }
            return false;
        }catch (Exception e){
            return false;
        }
    }

    @Override
    public Pay QueryPay(String pay_no) {
        return payMapper.selectOne(new QueryWrapper<Pay>().eq("payno",pay_no));
    }

    @Override
    public Integer UpdatePayByStatus(String pay_no, Integer status) {
        pay = new Pay();
        pay.setStatus(status);
        return payMapper.update(pay,new QueryWrapper<Pay>().eq("payno",pay_no));
    }
}
